package com.test;
public class AnotherSimpleThread implements Runnable {
    Thread thread;
    public AnotherSimpleThread() {}
    public AnotherSimpleThread(String name) {
        thread = new Thread(this, name);
        thread.start();
    }
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(i + " " + thread.getName());
            try {
                thread.sleep((long) (Math.random() * 1000));
            } catch (InterruptedException e) {
            }
        }
        System.out.println("DONE! " + thread.getName());
    }
}
class AnotherTwoThreadsTest {
    public static void main(String[] args) {
        new AnotherSimpleThread("Bali");
        new AnotherSimpleThread("Jogja");
        new SimpleThread("Medan").start();
        new SimpleThread("Jakarta").start();
    }
}